package cs9322.assign3.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;

import cs9322.assign3.dao.PaymentDao;
import cs9322.assign3.dao.PaymentsDao;
import cs9322.assign3.model.Payment;

public class PaymentResource {

	@Context
	UriInfo uriInfo;
	@Context
	Request request;
	int id;
	public PaymentResource(UriInfo uriInfo, Request request, int id) {
		this.uriInfo = uriInfo;
		this.request = request;
		this.id = id;
	}
	
	@GET
	@Produces(MediaType.TEXT_XML)
	public Payment getPaymentHTML() {
		PaymentDao pd = new PaymentDao();
		Payment p = pd.findByOrderId(id);
//		Payment p = PaymentsDao.instance.getStore().get(Integer.toString(id));
//		if(p == null)
//			throw new RuntimeException("GET: Order with id:" + id +  " not found");
		return p;
	}
}
